Skip to content

CCM-7478: Enable Test Coverage Reporting in Sonar#1007

Merged
gareth-allan merged 21 commits into
releasefrom
feature/CCM-7478_sonarqube_test_coverage
Oct 2, 2025
Merged

CCM-7478: Enable Test Coverage Reporting in Sonar#1007
gareth-allan merged 21 commits into
releasefrom
feature/CCM-7478_sonarqube_test_coverage

Conversation

@gareth-allan
Copy link
Copy Markdown
Contributor

@gareth-allan gareth-allan commented Sep 29, 2025

Summary

CCM-7478

This PR enables reporting of test coverage metrics in SonarCloud.

Changes:

  • Added commands to the Test sandbox server step of the build workflow that use the lcov-result-merger package (as used in the nhs-notify-repository-template repository) to generate an lcov.info file with the correct file paths for Sonar to interpret
  • Updated the Sonar configuration (scripts/config/sonar-scanner.properties) to:
    • Specify that the Sonar scan should wait for the quality gate result and fail the build if it fails
    • Set the appropriate source/test paths
    • Configure test coverage reporting
  • Removed an unused mocha-multi package from the sandbox application

Verification

Verified in the build output that the lcov.info file is being read as part of the Sonar scan:
Screenshot 2025-09-30 at 10 56 22

Verified in the build output that the scan is waiting for the quality gate results:
Screenshot 2025-09-30 at 10 57 02
(Also, see df79145 for a commit which was deliberately failing the quality gate.)

Verified that the Sonar dashboard is (attempting) to show coverage:
Screenshot 2025-09-30 at 10 52 47
Note that the message given for another branch, without the changes in this PR tells us coverage reporting isn't enabled:
Screenshot 2025-09-30 at 10 53 09

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Checklist

  • Brief description of work completed, and any technical decisions made as part of the PR
  • PR link added as a comment to the relevant JIRA ticket
  • PR link shared on Slack and/or Teams
  • 2 reviews received
  • Tester approval

@gareth-allan gareth-allan changed the title Feature/ccm 7478 sonarqube test coverage CCM-7478: Enable Test Coverage Reporting in Sonar Sep 29, 2025
@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

@github-actions
Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-7478

Comment thread scripts/config/sonar-scanner.properties
@gareth-allan gareth-allan marked this pull request as ready for review September 30, 2025 09:48
@gareth-allan gareth-allan merged commit f09023b into release Oct 2, 2025
6 checks passed
@gareth-allan gareth-allan deleted the feature/CCM-7478_sonarqube_test_coverage branch October 2, 2025 09:29
Kennedy1265 pushed a commit that referenced this pull request Oct 2, 2025
* CCM-7478: Remove unnecessary sandbox dependency

* CCM-7478: Configure test coverage reporting

* CCM-7478: Don't set Node.js path for Sonar

* CCM-7478: Make Sonar scan fail if quality gate fails
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants